#include "TestThread.h"
#include "Logger.h"

void TestThread::run()
{
	INFOLOGGER("client connenct succussfully!");
	const char reponse[] = "ok";
	char buff[1024] = { 0 };
	while (true)
	{
		int recvInfo = mClient.recv(buff, sizeof(buff) - 1);
		if (recvInfo <= 0)
		{
			ERRORLOGGER("Error!");
			break;
		}
		if (strstr(buff, "quit") != NULL)
		{
			INFOLOGGER("quit");
			break;
		}
		INFOLOGGER("recv info: %s", buff);
		mClient.send(reponse, sizeof(reponse));
	}
	mClient.close();
	delete this;
}
